import Vue from 'vue'
import Router from 'vue-router'

// RouterTab 内置路由
// import {
//     RouterTabRoutes
// } from 'vue-router-tab'

// 异步加载页面组件
const importPage = view => () =>
    import( /* webpackChunkName: "p-[request]" */ `../components/${view}.vue`)

Vue.use(Router)

const routes = [
    // ...RouterTabRoutes,
    {
        path: '/',
        name: 'Home',
        component: importPage('Home'),
        meta: {
            title: '首页',
            closable: false
        }
    },
    {
        path: '/demo',
        name: 'Demo',
        component: importPage('Demo'),
        meta: {
            title: '项目组件'
        }
    },
    {
        path: '/demo/bzt',
        name: 'BZT',
        component: importPage('BZT'),
        meta: {
            title: '饼状图组件'
        }
    },
    {
        path: '/demo/dtpxzzt',
        name: 'DTPXZZT',
        component: importPage('DTPXZZT'),
        meta: {
            title: '动态排序柱状图组件'
        }
    }, {
        path: '/demo/jbddmjt',
        name: 'JBDDMJT',
        component: importPage('JBDDMJT'),
        meta: {
            title: '渐变堆叠面积图组件'
        }
    }, {
        path: '/demo/ndgemgt',
        name: 'NDGEMGT',
        component: importPage('NDGEMGT'),
        meta: {
            title: '南丁格尔玫瑰图组件'
        }
    }, {
        path: '/demo/qthxt',
        name: 'QTHXT',
        component: importPage('QTHXT'),
        meta: {
            title: '嵌套环形图组件'
        }
    }, {
        path: '/demo/sdt',
        name: 'SDT',
        component: importPage('SDT'),
        meta: {
            title: '散点图组件'
        }
    }, {
        path: '/demo/xnfxt',
        name: 'XNFXT',
        component: importPage('XNFXT'),
        meta: {
            title: '性能分析图组件'
        }
    }, {
        path: '/demo/zftxt',
        name: 'ZFTXT',
        component: importPage('ZFTXT'),
        meta: {
            title: '正负条形图组件'
        }
    }, {
        path: '/demo/zxt',
        name: 'ZXT',
        component: importPage('ZXT'),
        meta: {
            title: '折线图组件'
        }
    }, {
        path: '/demo/zzhht',
        name: 'ZZHHT',
        component: importPage('ZZHHT'),
        meta: {
            title: '折柱混合图组件'
        }
    }, {
        path: '/demo/zzt', // 默认页和父级路由一致
        name: 'ZZT',
        component: importPage('ZZT'),
        meta: {
            title: '柱状图组件' // 页签标题
        }
    },
    {
        path: '/notice',
        component: importPage('Notice'),
        meta: {
            title: '公告页面', // 页签标题
            // icon: 'icon-user', // 页签图标，可选
            // tabClass: 'custom-tab', // 自定义页签 class，可选
            // tips: '这是一个页面', // 页签提示，可选，如未设置则跟 title 一致
            // key: 'path', // 路由打开页签规则，可选
            // closable: false // 页签是否允许关闭，默认 `true`
        }
    },
    {
        path: '/404',
        component: importPage('404'),
        meta: {
            title: '找不到页面',
            icon: 'icon-page'
        }
    }
]
routes
export default new Router({
    routes
})